﻿   @model Telerik.Web.Mvc.GridModel<Loja.DataDTO.ItemPedidoDTO>
@using Telerik.Web.Mvc.UI

  @{
      int gridPageSize = 10;
      
   }

    <table>
    <tr>
        <td>
            @(Html.Telerik().Grid<Loja.DataDTO.ItemPedidoDTO>(Model.Data)
                    .Name("Pedidos")
                    .Columns(columns =>
                    {
                        columns.Bound(ip => ip.Codigo);
                       
                        columns.Bound(ip => ip.CategoriaProduto)
                           .Width("250px");

                        columns.Bound(ip => ip.DscSubcategoriaProduto)
                          .Width("250px");
                        
                        columns.Bound(ip => ip.Tamanho)
                           .Width("100px");
                        
                        columns.Bound(ip => ip.Quantidade)
                        .Width("100px");

                        columns.Bound(ip => ip.Valor)
                      .Width("100px");
                        columns.Bound(ip => ip.ValorTotal)
                     .Width("100px");
                        
                        columns.Bound(ip => ip.IdItemPedido)
                            .Width(50)
                            .Template(ip => Ajax.ActionLink("Remover", "Remover", new { idItemPedido = ip.IdItemPedido }, new AjaxOptions { UpdateTargetId = "listaPedidos", HttpMethod = "get", InsertionMode = InsertionMode.Replace}));
                            
                    })
                    .Pageable(settings => settings.Total(Model.Total).PageSize(gridPageSize).Position(GridPagerPosition.Bottom))
                            .DataBinding(dataBinding => dataBinding.Ajax().Select("Listar", "Pedido"))
                    .EnableCustomBinding(true))
                    
        </td>
    </tr>
</table>

